package com.example.mapper;

import com.example.entity.Teacher;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

/**
 * @author： wzz
 * @date： 2021-07-28 18:06
 */


public interface TeacherMapper {

    int updateLoginTime(String loginTime,String num);

    @Select("select password from teachers where num=#{num}")
    String getTPassword(String num);


    @Select("select loginTime from teachers where num=#{num}")
    String getTLoginTime(String num);


    Integer ImportToMyBook(String classes,String book_name);

    /**
     * 查询教师信息
     * @param num
     * @return
     */
    @Select("select * from teachers where num=#{num}")
    Teacher GetTeacherByNum(String num);

    /**
     * 查询所有有被分配班级的教师
     *
     * @return
     */
    List<Teacher> queryAll();

    /**
     * 根据教工号查询学生信息
     *
     * @param jobNumber
     * @return
     */
    Teacher queryOne(String jobNumber);

    /**
     * 删除教工信息
     *
     * @param jobNumber
     * @return
     */
    int delTeacher(String jobNumber);

    /**
     * 添加授课老师
     *
     * @param teacher
     * @return
     */
    int addTeacher(Teacher teacher);

    /**
     * 更新学生的level
     *
     * @param jobNumber
     * @param classes
     * @return
     */
    int updataLevel(String jobNumber, String classes);


    /**
     * 教师查询
     *
     * @param jobNumber
     * @param name
     * @return
     */
    List<Teacher> searchTeacher(String jobNumber, String name);


    List<String> getBooks();

    /**
     * 更新教师常规信息
     *
     * @param jobNumber
     * @param name
     * @param phone
     * @return
     */
    int updateTeacher(String jobNumber, String name, String phone);

    /**
     * 修改
     *
     * @param jobNumber
     * @param
     * @return
     */
    int addBooks(String jobNumber, String book);


    List<String> getMyBooks(String num);

    /**
     * 删除任课
     * @param books
     * @return
     */
    @Delete("delete from tea_choice where book_name = #{books}")
    Integer cancelTeacher(String books);

    /**
     * 清空教师任课
     * @param num
     * @return
     */
    @Delete("delete from tea_choice where teacher_num=#{num}")
    Integer cancelBooks(String num);

    @Update("update teachers set password=#{password} where num=#{num}")
    int updatePassword(String num, String password);

}
